/*菜单api*/

import request from '@/utils/request'

// 菜单分页
export function menuPage(params) {
  return request({
    url: '/menu/page',
    method: 'get',
    params: params
  });
}

  // 新增菜单
  export function addMenu(params) {
  let data= {
   "parentId":params.parentId,
    "type":params.type,
    "text":params.menuName,
    "name":params.name,
  };
    return request({
      url: '/menu/insert',
      method: 'post',
      data
    });
  }


// 编辑菜单
export function updateMenu(params) {
  let data= {
    "type":params.type,
    "text":params.menuName,
    "name":params.name,
    "id":params.id,
  };
  return request({
    url: '/menu/update',
    method: 'post',
    data
  });
}

// id获取菜单信息
export function getById(id) {
  let data= {
    "id":id,
  };
  return request({
    url: '/menu/getById',
    method: 'get',
    params:data
  });
}


// iview树形控件查询菜单
export function allMenuIvTree(roleId) {
  let data = {
    "roleId":roleId,
  };
  return request({
    url: '/menu/allMenuIvTree',
    method: 'get',
    params: data
  });
}


// iview树形控件查询菜单
export function delById(menuId) {
  let data = {
    "id":menuId,
  };
  return request({
    url: '/menu/delById',
    method: 'delete',
    params:data
  });
}


// 菜单排序移动
export function moveMenu(upFlag,id,paregtId) {
  let data = {
    "id":id,
    "upFlag":upFlag,
    "parentId":paregtId
  };
  return request({
    url: '/menu/moveSort',
    method: 'get',
    params:data
  });
}


  // iview树形控件查询菜单
  export function currentMenu() {
    return request({
      url: '/menu/currentMenu',
      method: 'get',
    });
  }


